package com.espirit.eap.relationship;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class PartyRelationshipType implements Serializable{
	private static final long serialVersionUID = 1338131739194201684L;
	private Integer id;
	private PartyType partyTypeParent;
	private PartyType partyTypeChild;
	private String name;
	private String constrain;
	
	public PartyRelationshipType(){}

	public void setId(Integer id) {
		this.id = id;
	}

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setPartyTypeParent(PartyType partyTypeParent) {
		this.partyTypeParent = partyTypeParent;
	}
	@ManyToOne(targetEntity = PartyType.class,fetch=FetchType.LAZY)
	@JoinColumn(name = "parentPartyType") 
	public PartyType getPartyTypeParent() {
		return partyTypeParent;
	}

	public void setPartyTypeChild(PartyType partyTypeChild) {
		this.partyTypeChild = partyTypeChild;
	}

	@ManyToOne(targetEntity = PartyType.class,fetch=FetchType.EAGER)
	@JoinColumn(name = "childPartyType") 
	public PartyType getPartyTypeChild() {
		return partyTypeChild;
	}

	public void setConstrain(String constrain) {
		this.constrain = constrain;
	}

	public String getConstrain() {
		return constrain;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}
}
